/**
 * Created by huotaol on 2017/4/20.
 */
import {applyMiddleware, createStore} from "redux";
import createSagaMiddleware from "redux-saga";
import logger from "redux-logger";
import rootReducer from "../reducer/index.js";
import rootSaga from "../saga/index";

const middleWares = [];
const saga = createSagaMiddleware();

middleWares.push(saga);
if (__DEV__) {
    middleWares.push(logger);
}

const store = createStore(rootReducer, applyMiddleware(...middleWares));
saga.run(rootSaga);

export default store;
